$(function(){
	
	
	
	//获取总页数
	$.getJSON('../../AllPages',{
		flag:'user'
	},function(data,status){
		if(status){
			console.log(data[0].pages);
			var pages = data[0].pages;
			
			$('#pageLimit').bootstrapPaginator({
				currentPage : 1,
				totalPages : parseInt(pages),
				size : "normal",
				bootstrapMajorVersion : 3,
				alignment : "right",
				numberOfPages : 5,
				itemTexts : function(type, page, current) {
					switch (type) {
					case "first":
						return "首页";
					case "prev":
						return "上一页";
					case "next":
						return "下一页";
					case "last":
						return "末页";
					case "page":
						return page;
					}
				},

				onPageClicked : function(event, originalEvent, type, page) {
					console.log("1:" + page);
					
					allUserPage(page);
					
				},
			});
			
			
			
		}
	});
	
	

	//显示第一页
	allUserPage(1);
	
	function allUserPage(page){
		$.getJSON('../../UserInfoPage',{
			pageShowNumber:5,
			currentPage:page
		},function(data,status){
			
			$('tbody').empty();
			for(var i=0;i<data.length;i++){
				
				$('tbody').append('<tr><td>'+data[i].VIP_ID+'</td><td>'+data[i].VIP_NAME+'</td><td>'+data[i].VIP_ALLMONEY+'</td><td>'+data[i].VIP_REGISTDATE+'</td></tr>');
				
			}
			
		});
	}
	
	function userPage(page){
		
	}
	
	
	
})